function getServerHost() {

    var host1 = "..";
    var host2 = "http://www.chyin.site:8090";
    return host2;
    // return host2;

}
window.alert = function(name){
    var iframe = document.createElement("IFRAME");
    iframe.style.display="none";
    iframe.setAttribute("src", 'data:text/plain,');
    document.documentElement.appendChild(iframe);
    window.frames[0].window.alert(name);
    iframe.parentNode.removeChild(iframe);
}
//处理传过来的字符串
function getJsonFromStr(str) {
    str = str.split(';');
    let detail_list = [];
    let total_list = [];
    let index = 0;

    function split_key_val(str) {
        let obj = {
            _name: '',
            _val: ''
        };
        let attr = str.split(':');
        [obj._name, obj._val] = [
            attr[0], attr[1]
        ];
        // console.log(attr[0], attr[1]);
        return obj;

    }
    for (let i = 0; i < str.length-1; i++) {
        var val = {};
        if (str[i].trim().indexOf('--') > -1) {
            detail_list[index].details.push(split_key_val(str[i]));
        } else if (str[i].trim().indexOf('合计') > -1) {
            total_list.push({
                'total': split_key_val(str[i]),
                'details': []
            });
        } else {
            detail_list.push({
                'total': split_key_val(str[i]),
                'details': []
            });
            index = detail_list.length - 1;
        }
    }
    console.log(total_list);
    console.log(detail_list);
    return {
        "total":total_list,
        "detail":detail_list

    };
}
//横屏无效
window.addEventListener("orientationchange", function() {
    // Announce the new orientation number
    if(0!==window.orientation){
        // $('.container').hide().after("<div  style='text-align: center'>请竖屏浏览</div>");
        alert('请竖屏浏览')
    }else{
        // $('.container').show().next().empty();
    }
}, false);
